 <?php  
    echo $this->session->flash(); 
    if(!empty($contractData)){
        $this->Paginator->options(array(
           'update' => '#divUpdate',
           'evalScripts' => true, 
        ));

    } 
?>
<div class="file" id="List">
       <table width="100%" border="0" cellspacing="1" cellpadding="2" class="list">
        <tr class="heading"  bgcolor="#708089">
            <th width="6%" valign="top" align="left"><?php  echo __('S.NO');?></th>
            <th valign="top" width="30%" align="left"><?php echo $this->Paginator->sort('title', __('TITLE',true)); ?></th>
            <th valign="top" width="10%" align="left"><?php  echo __('ACTION');?></th>
        </tr>
	<?php
        if(isset($contractData) && count($contractData)>0){
            $i=0;
            foreach($contractData as $arrayDetail){
            ?>
            <tr class="<?php echo (($i%2) == 0)? 'even' : 'odd';?>">
		    <td>&nbsp;<?php echo $i+1?></td>
                        <td>&nbsp;<?php echo $arrayDetail['Contract']['title'];?></td>
                        <td><?php
                            if(!$roleId){//No checks for superadmin
                                echo $this->html->link(
                                    $this->Html->image('icons/16/document_file.png'), 
                                    array(
                                        'controller' => 'contracts',
                                        'action' => 'download', $arrayDetail['Contract']['id']
                                    ), array(
                                        'alt' => __('DOWNLOAD', true),
                                        'title' => __('DOWNLOAD', true),
                                        'escape'=>false
                                    )
                                );
                                echo ' | ';
                                echo $this->html->link(
                                        $this->Html->image('icons/16/edit_icon.png'), array(
                                    'controller' => 'contracts',
                                    'action' => 'edit', $arrayDetail['Contract']['id'], $batch_list_id
                                        ), array(
                                    'alt' => __('EDIT', true),
                                    'title' => __('EDIT', true),
                                    'escape' => false
                                        )
                                );
                                echo ' | ';
                                echo $this->Js->link(
                                        $this->Html->image('icons/16/cross.png', array('title' => 'Delete Contract')), array(
                                    'controller' => 'contracts',
                                    'action' => 'delete/' . $arrayDetail['Contract']['id'], $batch_list_id
                                        ), array(
                                    'update' => '#divUpdate',
                                    'escape' => false,
                                    'before' => $this->Js->get('#processingDiv')->effect('fadeIn'),
                                    'success' => $this->Js->get('#processingDiv')->effect('fadeOut'),
                                    'confirm' => 'Are you sure you wish to delete this Contract? You can\'t revert it back'
                                        )
                                );
                            }else{
                                echo $this->html->link(
                                    $this->Html->image('icons/16/document_file.png'), 
                                    array(
                                        'controller' => 'contracts',
                                        'action' => 'download', $arrayDetail['Contract']['id']
                                    ), array(
                                        'alt' => __('DOWNLOAD', true),
                                        'title' => __('DOWNLOAD', true),
                                        'escape'=>false
                                    )
                                );
                                
                                if($showContractEditURL){
                                    echo ' | ';
                                    echo $this->html->link(
                                           $this->Html->image('icons/16/edit_icon.png'), 
                                           array(
                                               'controller' => 'contracts',
                                               'action' => 'edit', $arrayDetail['Contract']['id'], $batch_list_id
                                           ), array(
                                               'alt' => __('EDIT', true),
                                               'title' => __('EDIT', true),
                                               'escape'=>false
                                           )
                                          );
                                }
				
				if($showContractDeleteURL){
				    echo ' | ';
				    echo $this->Js->link(
					    $this->Html->image('icons/16/cross.png', array('title' => 'Delete Contract')), array(
					'controller' => 'contracts',
					'action' => 'delete/' . $arrayDetail['Contract']['id'], $batch_list_id
					    ), array(
					'update' => '#divUpdate',
					'escape' => false,
					'before' => $this->Js->get('#processingDiv')->effect('fadeIn'),
					'success' => $this->Js->get('#processingDiv')->effect('fadeOut'),
					'confirm' => 'Are you sure you wish to delete this Contract? You can\'t revert it back'
					    )
				    );
				}
                            }
			?>
		     </td>
              </tr>  
          <?php
          $i++;
          }
        }
        ?>
	<tr><td colspan="9" bgcolor="#ffffff" align="center"><div class="pagination">            
	      <?php		     
	      if(!empty($contractData)){
		     echo $this->Element('pagination');
	      } else{
		     echo __("NO_RECORD_MESSAGE");
	      }
              ?>              
          </div></td></tr>
	
	<tr bgcolor="#ffffff">
	    <td colspan="9" valign="top">
	       <table width="100%">
		  <tr>
		     <td width="10%">
			<b><?php echo __('LEGENDS')?> :- </b> 
		     </td>
		     <td width="20%">
			<?php echo $this->html->image('/img/icons/16/document_file.png');?>

			<?php echo __('DOWNLOAD_CONTRACT')?>
		     </td>
                     <td width="20%">
			<?php echo $this->html->image('/img/icons/16/edit_icon.png');?>

			<?php echo __('EDIT_CONTRACT')?>
		     </td>
                     <td width="50%">
			<?php echo $this->html->image('/img/icons/16/cross.png');?>

			<?php echo __('DELETE_CONTRACT')?>
		     </td>
		  </tr>
		</table>
	    </td>
	 </tr>
       </table>
</div>
<?php echo $this->Js->writeBuffer();?>